import Vue from 'vue'

Vue.mixin({
  methods: {
    $toast (message, { duration = 2500, ...rest }) {
      const modal = this.$info({
        width: 'auto',
        ...rest,
        content: message,
        centered: true,
        // mask: false,
        maskClosable: true,
        class: 'modal-toast',
      })

      if (duration && duration > 0) {
        setTimeout(() => modal.destroy(), duration)
      }

      return modal
    },
  },
})
